home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
language
/
sozobon1.zoo
/
include
/
macros.h
< prev
next >
Wrap
C/C++ Source or Header
|
1990-11-16
|
649b
|
27 lines
/*
* MACROS.H commonly useful macros
*/
#ifndef MACROS_H
#define MACROS_H
/* absolute value for any type of number */
#define abs(x) ((x)<0?(-(x)):(x))
/* maximum and minumum for any type of number */
#define max(x,y) (((x)>(y))?(x):(y))
#define min(x,y) (((x)<(y))?(x):(y))
/* swap any objects which can be XORed */
#define swap(a,b) ((a)=(a)^((b)=(b)^((a)=(a)^(b))))
/* lo and hi byte of a word */
#define lobyte(x) (((unsigned char *)&(x))[1])
#define hibyte(x) (((unsigned char *)&(x))[0])
/* lo and hi word of a long */
#define loword(x) (((unsigned int *)&(x))[1])
#define hiword(x) (((unsigned int *)&(x))[0])
#endif MACROS_H